<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<!-- 引入codemirror 外部基本资源js css -->
	<link rel="stylesheet" href="codemirror/codemirror.css">
	<script src="codemirror/codemirror.js"></script>
	<!-- 引入mode  此处为js mode-->
	<script src="codemirror/javascript.js"></script>
	<style>
	.CodeMirror {
			/* font-size: 18px; */
	}
	</style>
	<body>
	    <!-- 创建编辑区域1 -->
	    <form >
	        <textarea id="myTextarea"></textarea>
	    </form>
	</body>
	<script type="text/javascript">
		var editor = CodeMirror.fromTextArea(document.getElementById("myTextarea"), {
			mode: "text/javascript", //实现高亮模式
			lineNumbers: true, //显示行号
			thneme: "darcula", //设置主题
			lineWrapping: true, //代码折叠
			foldGutter: true,
			matchBrackets: true,  //括号匹配
			utters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"],
			autoCloseBrackets: true,
			extraKeys:{"Ctrl-Space":"autocomplete"}//ctrl-space唤起智能提示
		});
		editor.on('blur',function(){
			console.log(editor.getValue())
		} )
		 
		function getInputValue(){
			document.getElementById("showContent").innerText = editor.getValue();
		}
	</script>
</html>
